<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use App\Models\User;
use App\Models\VisaOrder;
use App\Models\VisaOrderProcess;

class VisaController extends Controller
{
    public function login(Request $request)
    {
        // $wechat_user =  session('wechat.oauth_user.default');
        
        // $user = User::where('openid',$wechat_user->id)->first();
        // if($user) {
        //     $request->session()->put('user', $user);
        //     return redirect('user/task');    
        // }
        
        //$provinces  = $this->getDistrict(0);
    	return view('visa.login');
    }

    public function index(Request $request)
    {
        $where = $request->only(['phone','service_code']);
        $order = VisaOrder::where($where)->first();

        $list = [];
        if($order) {
            $list = VisaOrderProcess::where(['order_id'=>$order->id])->get();
        }
        
        return view('visa.index',compact('order','list'));
    }

    

   

    
}
